package com.lineage.server.model.Instance;

import com.lineage.server.model.L1Object;
import com.lineage.server.serverpackets.S_RemoveObject;
import com.lineage.server.serverpackets.ServerBasePacket;
import com.lineage.server.templates.L1Npc;
import com.lineage.server.world.World;
import java.util.Iterator;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

public class L1FurnitureInstance extends L1NpcInstance {
  private static final long serialVersionUID = 1L;
  
  private static final Log _log = LogFactory.getLog(L1FurnitureInstance.class);
  
  private int _itemObjId;
  
  public L1FurnitureInstance(L1Npc template) {
    super(template);
  }
  
  public void onAction(L1PcInstance player) {}
  
  public void deleteMe() {
    try {
      this._destroyed = true;
      if (getInventory() != null)
        getInventory().clearItems(); 
      World.get().removeVisibleObject((L1Object)this);
      World.get().removeObject((L1Object)this);
      Iterator<L1PcInstance> iterator = World.get().getRecognizePlayer((L1Object)this).iterator();
      while (iterator.hasNext()) {
        L1PcInstance pc = iterator.next();
        pc.removeKnownObject((L1Object)this);
        pc.sendPackets((ServerBasePacket)new S_RemoveObject((L1Object)this));
      } 
      removeAllKnownObjects();
    } catch (Exception e) {
      _log.error(e.getLocalizedMessage(), e);
    } 
  }
  
  public int getItemObjId() {
    return this._itemObjId;
  }
  
  public void setItemObjId(int i) {
    this._itemObjId = i;
  }
}
